<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <script type="text/javascript" src="/pages/js/jquery.min.js"></script>
    <script type="text/javascript" src="/pages/js/amazeui.min.js"></script>
    <script type="text/javascript" src="/pages/js/layer.js"></script>

    <link rel="stylesheet" href="/pages/css/amazeui.min.css" type="text/css"/>
    <link rel="stylesheet" href="/pages/css/style.css" type="text/css"/>
    <title>个人中心</title>
</head>
<body>
<header data-am-widget="header" class="am-header am-header-default jz">
    <div class="am-header-left am-header-nav">
        <a href="javascript:history.back()" class="">
            <i class="am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        <a href="#title-link" class="">个人中心</a>
    </h1>
</header>
<div class="wo">
    <img th:src="${headimgurl}"/>
    <p><a href=""><span th:text="${nickName}"></span> <i class="am-icon-angle-right"></i></a></p>
</div>
<ul class="member">
    <li>
        <a href="/user/facelist.html">
            <h2 th:text="${facePicCount}"></h2>
            <p>注册人脸数</p>
        </a>
    </li>
    <li>
        <a href="#">
            <h2 th:text="${communityConut}"></h2>
            <p>小区</p>
        </a>
    </li>
    <li>
        <a href="/user/news.html">
            <h2>0</h2>
            <p>未读信息</p>
        </a>
    </li>
</ul>

<ul class="nav">
    <li>
        <a href="/user/suggest.html">
            <img src="/pages/images/i3.png"/>
            <span>意见反馈</span>
            <i class="am-icon-angle-right"></i>
        </a>
    </li>
</ul>

<!--<a href="/user/reg.html"> <input type="button" value="绑定微信" class="money-btn" ></a>-->
<a href="/logout">
    <input type="button" value="退出登陆" class="money-btn" >
</a>
<input type="button" class="money-btn" onclick="unBind(this)" value="解除绑定">

<div style="height: 49px;"></div>
<div data-am-widget="navbar" class="am-navbar  gm-foot am-no-layout" id="foot">
    <ul class="am-navbar-nav am-cf am-avg-sm-4">
        <li>
            <a href="/user/index.html">
                <span class="am-icon-home"></span>
                <span class="am-navbar-label">首页</span>
            </a>
        </li>
        <li>
            <a href="/user/alarmrecord.html">
                <span class="am-icon-th-large"></span>
                <span class="am-navbar-label">记录</span>
            </a>
        </li>
        <li class="curr">
            <a href="/user/member.html">
                <span class="am-icon-user"></span>
                <span class="am-navbar-label">我的</span>
            </a>
        </li>

    </ul>
</div>

<script>
    //解除绑定
    function unBind(obj) {
        //$(obj).remove();//移除当前标签
        layer.open({
            content: '确认解绑微信吗？每个账户每日只能接收2次验证码，请谨慎操作！',
            btn: ['确认', '取消'],
            shadeClose: false, //默认：true，是否点击遮罩时关闭层
            yes: function() {
                $(obj).hide();//隐藏当前标签
                var loading = layer.open({
                    type: 2,
                    shadeClose: false,
                    content: '正在加载'
                });
                //发出解绑请求请求
                $.get("/userDo/unBind.do",function(data){
                    if(data.code==200){
                        //关闭加载动画
                        layer.close(loading);
                        //发起退出登陆操作
                        window.location.href = "/logout";
                    }else {
                        //关闭加载动画
                        layer.close(loading);
                        //弹出错误提示
                        layer.open({
                            content: data.msg+"code:"+data.code,
                            time: 3,
                            btn: ['确认']
                        });
                        $(obj).show();//显示绑定标签
                    }
                }, "json").error(function (xhr,status,info) {
                    //console.log(xhr.status);
                    //console.log('错误信息：'+info);
                    //关闭加载动画
                    layer.close(loading);
                    layer.open({
                        content: '网络异常,请稍后再试!',
                        time: 3,
                        btn: ['确认']
                    });
                    $(obj).show();//显示当前标签
                });
            },
            no: function() {
                layer.open({
                    content: '已取消',
                    time: 2
                });
            }
        });

    }
</script>

</body>
</html>
